USE [HoggeryOnline_DB]
GO

/****** Object:  StoredProcedure [dbo].[GetAllPigPens_Proce]    Script Date: 10/24/2014 6:44:14 PM ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

-- =============================================
-- Author:		Velox
-- Create date: 2014-10-23
-- Description:	get hoggery all pigpens
-- =============================================
if exists (select * from sysobjects where id = object_id('dbo.GetAllPigPens_Proce'))
	drop PROCEDURE "dbo"."GetAllPigPens_Proce"
GO
CREATE PROCEDURE [dbo].[GetAllPigPens_Proce] (
	-- Add the parameters for the stored procedure here
	@hoggeryId int
	)
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;
	SELECT pp.HoggeryID,pp.CustomizeID,pp.CurrentPigCount,f.FeederID,f.FeederName FROM pigpen pp
LEFT JOIN Feeders f
ON pp.FeederID=f.FeederID and pp.HoggeryID=f.HoggeryID
WHERE PP.HoggeryID=@hoggeryId
END

GO


